package com.foreknow.demo;
/**
 * @author shkstart
 * @create 2021-07-22 10:440
 */

import java.util.Scanner;

/**
 * 方法：就是一个功能
 * 访问权限  返回值类型 方法名(参数列表){   }
 * return 返回值
 */
public class Java {
    /**
     * 累加求和
     *
     * @param a
     * @param b
     * @return
     */
    public static int method2(int a, int b) {
        return a + b;
    }

    public static int[] method4() {
        int[] arry = {1, 3, 4, 8, 5, 22, 46};
        return arry;
    }

    public static int[] method5(int[] arry) {
        return arry;
    }

    public static boolean method3(String username, String password) {
        System.out.println(username + "-----------" + password);
        return false;
    }

    public static void main(String[] args) {
        int[] arry = {1, 3, 4, 8, 5, 22, 46};
        int[] arr1 = Java.method5(arry);
        for (int i = 0; i < arr1.length; i++) {
            System.out.print(arr1[i]+" ");
        }
        System.out.println();
        System.out.println("***************");
        for (int i = 0; i < arry.length; i++) {
            System.out.print(arry[i] + " ");
        }
        int sum = Java.method2(1, 2);
        System.out.println(sum);

        boolean isRight = Java.method3("admin", "123465");
        if (isRight) {
            System.out.println("success...");
        } else {
            System.out.println("error......");
        }

//        System.out.println("请输入用户名");
//        Scanner sc=new Scanner(System.in);
//        String  id=sc.nextLine();
//        System.out.println("请输入密码");
//        String pas=sc.nextLine();
//        Java j=new Java();
//        boolean flag=j.login(id,pas);
//        if(flag){
//            System.out.println("登录成功");
//        }else {
//            System.out.println("登录失败");
//        }

    }


    public boolean login(String userid, String password) {
        if (userid.equals("admin") && password.equals("123456")) {
            return true;
        } else {
            return false;
        }

    }
}
